import { ExtIdTuple, INTEGER_PG } from "~/db.pg";
import { ExtSkuTpl, Tradable } from "~/extend";

import { ExtOwner } from "@/stream-user/core.define";
import { MarketOrder } from "@/river-market/schema.order";

/** 运营中心回收钻石
 * @count 钻石个数
 * @price 始终是0
 */
export type AppDueTpl = ExtOwner &
  ExtIdTuple &
  ExtSkuTpl & {
    /** 时长（天）*/
    duration: INTEGER_PG;
  };

/** 运营中心回收钻石
 * @refCreatorId 一定是客户自己
 * @refContactId 要把客户做成运营中心的联系人
 * @contractTime MarketOrder 消费订单中约定了本次应用服务的到期时间
 */
export type AppDueSku = AppDueTpl &
  Tradable & {
    refMarketOrderId: MarketOrder["uuid32"];
    justMarketOrder?: MarketOrder;
  };
